package com.leyou.item.mapper;

import com.leyou.item.pojo.Brand;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface BrandMapper extends Mapper<Brand> {
    @Insert("insert into tb_category_brand values(#{cid},#{id})")
    void saveCategoryAndBrand(@Param("cid") Long cid,@Param("id") Long id);
    @Delete("delete from tb_category_brand where brand_id = #{id}")
    void deleteCategoryAndBrand(Long id);
    @Select("SELECT * FROM tb_brand WHERE id IN (SELECT brand_id FROM tb_category_brand WHERE category_id = #{cid})")
    List<Brand> selectBrandsByCid(Long cid);
}
